package review.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import review.bean.LoginBean;

import java.io.IOException;

public class LoginServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        LoginBean loginBean = (LoginBean) req.getSession().getAttribute("loginBean");
        if(loginBean == null){
            loginBean = new LoginBean();
            req.setAttribute("loginBean",loginBean);
        }
        String name = req.getParameter("text");
        if(name != null){
            loginBean.setName(name);
            loginBean.setPass("");
        }
        req.getRequestDispatcher("jsp/review/submit.jsp").forward(req,resp);
    }
}
